package com.codemes.happylist;


import de.felixroske.jfxsupport.SplashScreen;
import javafx.scene.Parent;
import javafx.scene.control.ProgressBar;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;

import java.net.URL;

/**
 * @author nscoffee
 */
public class CodemesLaunchSplashScreen extends SplashScreen {

    private static final String SPLASH_SCREEN_IMAGE="/splash/splash.jpg";

    @Override
    public Parent getParent() {
        final ImageView imageView = new ImageView(getClass().getResource(getImagePath()).toExternalForm());
        final ProgressBar splashProgressBar = new ProgressBar();
        splashProgressBar.setPrefWidth(imageView.getImage().getWidth());
        splashProgressBar.setPrefHeight(10.0d);
        final VBox vbox = new VBox();
        vbox.getChildren().addAll(imageView, splashProgressBar);
        return vbox;
    }
    @Override
    public String getImagePath() {
        return SPLASH_SCREEN_IMAGE;
    }
}
